package com.foreknow.elm.controller;

import com.foreknow.elm.po.Business;
import com.foreknow.elm.service.BusinessService;
import com.foreknow.elm.service.impl.BusinessServiceImpl;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public class BusinessController {
    /**
     * 功能：根据点餐分类编号查询所属商家信息
     * @param request
     * @return
     */
    public Object listBusinessByOrderTypeId(HttpServletRequest request) {
        //获取请求参数 /BusinessCon/listBusinessByOrderTypeId?orderTypeId=1
        String id = request.getParameter("orderTypeId");
        BusinessService businessService = new BusinessServiceImpl();
        List<Business> list = businessService.listBusinessByOrderTypeId(Integer.valueOf(id));
        return list;
    }

    /**
     * 功能：根据商家编号查询商家信息
     *
     * @param request
     * @return
     */
    public Object getBusinessById(HttpServletRequest request) {
        String id = request.getParameter("businessId");
        BusinessService businessService = new BusinessServiceImpl();
        Business business = businessService.getBusinessById(Integer.valueOf(id));
        return business;
    }
}
